package com.jrx.anytxn.param.service.rights;

import com.jrx.anytxn.common.exception.TxnBizException;
import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.i18n.response.TxnPage;
import com.jrx.anytxn.param.entity.PrRightsAndInterestsReq;
import com.jrx.anytxn.param.entity.PrRightsAndInterestsRes;
import com.jrx.anytxn.param.entity.PrRightsAndInterests;

import java.util.List;

public interface IPrRightsAndInterestsService {

    /**
     * 通过权益ID和租户ID查询
     * @param tenantId
     * @param rightsId
     * @return
     * @throws TxnException
     */
    PrRightsAndInterestsRes getByTenIdIdAndRightsId(String tenantId, String rightsId) throws TxnException;


    /**
     * 添加权益参数
     * @param prRightsAndInterestsReq
     * @return
     * @throws TxnException
     */
    Integer addPrRightsAndInterests(PrRightsAndInterestsReq prRightsAndInterestsReq) throws TxnException;

    /**
     * 获取所有权益参数信息
     * @param tenantId
     * @return
     */
    List<PrRightsAndInterestsRes> findAllByTenId(String tenantId);

    /**
     * 权益列表条件列表查询
     * @param pageNum
     * @param pageSize
     * @param req
     * @return
     * @throws TxnException
     */
    TxnPage<PrRightsAndInterestsRes> findAllPageByCondition(Integer pageNum, Integer pageSize, PrRightsAndInterestsReq req) throws TxnException;

    /**
     * 根据租户ID和权益ID修改
     * @param prRightsAndInterestsReq
     * @return
     * @throws TxnBizException
     */
    Integer modifyPrRightsAndInterests(PrRightsAndInterestsReq prRightsAndInterestsReq) throws TxnBizException;

    /**
     * 根据租户ID和权益ID删除信息
     * @param tenantId
     * @param rightsId
     * @return
     * @throws TxnBizException
     */
    Boolean removeByTenantIdAndRightsId(String tenantId, String rightsId) throws TxnBizException;

    /**
     * 通过权益ID和租户ID查询
     * 供api接口使用 页面调用不可使用该方法
     *
     * @param tenantId
     * @param rightsId
     * @return
     * @throws TxnBizException
     */
    PrRightsAndInterests getByRightsId(String tenantId, String rightsId) throws TxnBizException;

    /**
     * 根据机构号和租户编号查询
     * @param organizationId
     * @param tenantId
     * @return
     */
    List<PrRightsAndInterestsRes> getByOrgIdAndTenId(String organizationId, String tenantId);

    /**
     * 检验权益参数
     * @param tenantId
     * @param rightsId
     * @param productCode
     * @return
     */
    PrRightsAndInterests checkRightsAndInterests(String tenantId, String rightsId,String productCode) throws TxnBizException;

    /**
     * 根据租户id和权益类型查询权益列表
     * @param tenantId
     * @param rightsType
     * @return
     */
    List<PrRightsAndInterestsRes> selectByTenIdAndRightsType(String tenantId, String rightsType) throws TxnException;
    
    /**
     * 更新权益
     * @param prRightsAndInterests
     * @return
     */
    int update(PrRightsAndInterests prRightsAndInterests);

    void exchangeRightsInterests(String tenantId, String rightsId, int minusStoreQuantity);

}
